package com.xique.door.service.impl.estate;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xique.common.core.utils.StringUtils;
import com.xique.door.bean.domain.estate.EstateUserCard;
import com.xique.door.mapper.estate.EstateUserCardMapper;
import com.xique.door.service.estate.IEstateUserCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shd
 * @create 2022/6/9 15:56
 */
@Service
public class EstateUserCardServiceImpl extends ServiceImpl<EstateUserCardMapper, EstateUserCard> implements IEstateUserCardService {

    @Autowired
    private EstateUserCardMapper estateUserCardMapper;

    @Override
    public List<EstateUserCard> listByUserId(Long userId) {
        if (StringUtils.isNull(userId)) {
            return new ArrayList<>();
        }
        LambdaQueryWrapper<EstateUserCard> condition = Wrappers.lambdaQuery();
        condition.eq(EstateUserCard::getUserId, userId);
        return estateUserCardMapper.selectList(condition);
    }
}
